package org.bird.reference;

import java.lang.ref.ReferenceQueue;

/**
 * 虚引用:无法通过引用获取对象，下次垃圾回收时回收
 * @author liangjf
 *
 */
public class PhantomReference {

	public static void main(String[] args) {
		ReferenceQueue<String> queue = new ReferenceQueue<String>();
		java.lang.ref.PhantomReference<String> pr = new java.lang.ref.PhantomReference<String>(new String("hello"), queue);
		System.out.println(pr.get());
	}
}
